home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OCFINC.PAK / OCDOC.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  3KB  |  103 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectComponents
  3. // Copyright (c) 1994, 1997 by Borland International, All Rights Reserved
  4. //
  5. // $Revision:   2.10  $
  6. //
  7. // Definition of TOcDocument Class
  8. //----------------------------------------------------------------------------
  9. #if !defined(OCF_OCDOC_H)
  10. #define OCF_OCDOC_H
  11.  
  12. #if !defined(OCF_OCPART_H)
  13. # include <ocf/ocpart.h>
  14. #endif
  15. #if !defined(OCF_LINK_H)
  16. # include <ocf/oclink.h>
  17. #endif
  18.  
  19. class _ICLASS IStorage;
  20.  
  21. #if defined(BI_NAMESPACE)
  22. namespace OCF {
  23. #endif
  24.  
  25. //
  26. // Interfaces & Classes referenced
  27. //
  28. class _ICLASS TOcStorage;
  29. class _ICLASS TOcApp;
  30. class _ICLASS TOcControl;
  31. class _ICLASS TOcView;
  32.  
  33. //
  34. // class TOcDocument
  35. // ~~~~~ ~~~~~~~~~~~
  36. // OC Document class, holds parts & is a owner of views
  37. //
  38. class _ICLASS TOcDocument {
  39.   public:
  40.     TOcDocument(TOcApp& app, const char far* fileName = 0);
  41.     TOcDocument(TOcApp& app, const char far* fileName, IStorage far* storageI);
  42.    ~TOcDocument();
  43.  
  44.     // Collection management
  45.     //
  46.     TOcPartCollection& GetParts() {return PartCollection;}
  47.     TOcLinkCollection& GetLinks() {return LinkCollection;}
  48.     TOcLinkCollection& GetViews() {return LinkCollection;} // Compatibility
  49.  
  50.     // Storage & streaming related
  51.     //
  52.     TOcStorage* GetStorage() {return Storage;}
  53.     void        SetStorage(IStorage* storage, bool remember = true);
  54.     void        SetStorage(const char far* path);
  55.     bool        SaveToFile(const char far* newName);
  56.     bool        RestoreStorage();
  57.  
  58.     // Load/Save part information
  59.     //
  60.     bool        LoadParts();
  61.     bool        SaveParts(IStorage* storage = 0, bool sameAsLoaded = true,
  62.                           bool remember = true);
  63.     void        RenameParts(IBRootLinkable far* bLDocumentI);
  64.     void        Close();
  65.  
  66.     // Get/Set active view
  67.     //
  68.     TOcView*    GetActiveView() {return ActiveView;}
  69.     void        SetActiveView(TOcView* view);
  70.  
  71.     // Get/Set document name
  72.     //
  73.     string      GetName() const {return Name;}
  74.     void        SetName(const string& newName);
  75.  
  76.     int         AllocPartID() {return ++PartID;}
  77.     TOcApp&     GetOcApp() {return OcApp;}
  78.  
  79.   private:
  80.     TOcView*       ActiveView;   // Active TOcView object
  81.     TOcApp&        OcApp;        // Our OC application object
  82.     TOcStorage*    Storage;      // root storage for embedded objects
  83.     TOcStorage*    OrgStorage;   // original root storage for embedded objects
  84.  
  85.     int            PartID;
  86.     string         Name;
  87.     TOcPartCollection  PartCollection;
  88.     TOcLinkCollection  LinkCollection;
  89.  
  90.   friend class TOcPartCollectionIter; // To allow iterator access to collection
  91.   friend class TOcLinkCollectionIter; // To allow iterator access to collection
  92.   friend class _ICLASS TOcControl;
  93.   friend class _ICLASS TOcView;
  94.   friend class _ICLASS TOcRemView;
  95. };
  96.  
  97. #if defined(BI_NAMESPACE)
  98. } // namespace OCF
  99. #endif
  100.  
  101. #endif  // OCF_OCDOC_H
  102.  
  103.